<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    {% load static %}
    <link rel="stylesheet" href="{% static 'polls/style.css' %}">
    <title>{{ question.question_text }}</title>
    <style>
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }
        body {
            font-family: 'Helvetica Neue', Arial, sans-serif;
            line-height: 1.6;
            background-color: #f8f9fa;
            color: #333;
            padding: 20px;
        }
        .container {
            max-width: 800px;
            margin: 0 auto;
            background: white;
            border-radius: 10px;
            box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
            padding: 30px;
        }
        h1 {
            color: #2c3e50;
            margin-bottom: 25px;
            padding-bottom: 10px;
            border-bottom: 2px solid #3498db;
            font-size: 28px;
        }
        .error-message {
            color: #dc3545;
            background-color: #f8d7da;
            border: 1px solid #f5c6cb;
            padding: 12px;
            border-radius: 5px;
            margin-bottom: 20px;
            font-weight: bold;
        }
        .vote-form {
            margin-top: 20px;
        }
        fieldset {
            border: 1px solid #dee2e6;
            border-radius: 8px;
            padding: 20px;
            margin-bottom: 20px;
        }
        legend {
            font-weight: bold;
            color: #495057;
            padding: 0 10px;
            font-size: 18px;
        }
        .choice-item {
            margin: 15px 0;
            padding: 12px 15px;
            background: #f8f9fa;
            border-radius: 6px;
            transition: all 0.3s ease;
        }
        .choice-item:hover {
            background: #e9ecef;
        }
        .choice-item input[type="radio"] {
            margin-right: 10px;
            transform: scale(1.2);
        }
        .vote-btn {
            background: #3498db;
            color: white;
            border: none;
            padding: 12px 25px;
            border-radius: 6px;
            font-size: 16px;
            cursor: pointer;
            transition: background 0.3s;
        }
        .vote-btn:hover {
            background: #2186c4;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>{{ question.question_text }}</h1>

        {% if error_message %}
        <div class="error-message">
            <strong>{{ error_message }}</strong>
        </div>
        {% endif %}

        <form class="vote-form" action="{% url 'polls:vote' question.id %}" method="post">
            {% csrf_token %}
            <fieldset>
                <legend>请选择投票选项：</legend>
                {% for choice in question.choice_set.all %}
                <div class="choice-item">
                    <input type="radio" name="choice" id="choice{{ forloop.counter }}" value="{{ choice.id }}">
                    <label for="choice{{ forloop.counter }}">{{ choice.choice_text }}</label>
                </div>
                {% endfor %}
            </fieldset>
            <input type="submit" class="vote-btn" value="提交投票">
        </form>
    </div>
</body>
</html>